package com.hdd.art.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class RedisExpiredListener implements MessageListener {


    @Override
    public void onMessage(Message message, byte[] bytes) {
        byte[] body = message.getBody();// 建议使用: valueSerializer
        byte[] channel = message.getChannel();
        System.out.print("onMessage >>+++++++++++++++++++++++++ ");
        System.out.println(String.format("channel: %s, body: %s, bytes: %s"
                , new String(channel), new String(body), new String(bytes)));
        //修改订单,修改商品状态
        String str = String.format("body: %s", new String(body));

        if (str.startsWith("body: withdraw")) {

        }
    }


}